import { S } from '../../s';
import { PSAjaxControlContainerImpl } from '../psajax-control-container-impl';
import { IPSDEForm } from './ipsdeform';
import { IPSDEFormItem } from './ipsdeform-item';
import { IPSDEFormItemUpdate } from './ipsdeform-item-update';
import { IPSDEFormItemVR } from './ipsdeform-item-vr';
import { IPSDEFormPage } from './ipsdeform-page';
import { IPSLayout } from '../layout/ipslayout';

export class PSDEFormImpl
  extends PSAjaxControlContainerImpl
  implements IPSDEForm
{
  get codeName(): string {
    return this.M.codeName;
  }

  get formFuncMode(): 'WFACTION' | 'WIZARDFORM' {
    return this.M.formFuncMode;
  }

  get formStyle(): string {
    return this.M.formStyle;
  }

  get formWidth(): number {
    return this.M.formWidth != null ? this.M.formWidth : 0.0;
  }

  protected psdeformitemupdates: IPSDEFormItemUpdate[];
  getPSDEFormItemUpdates(): IPSDEFormItemUpdate[] | null {
    return (
      this.psdeformitemupdates ||
      (this.psdeformitemupdates = this.fillChildListModel(
        this.M.getPSDEFormItemUpdates,
        S._b9,
      ) as IPSDEFormItemUpdate[])
    );
  }

  findPSDEFormItemUpdate(objKey: any): IPSDEFormItemUpdate | null {
    return this.getPSModel5(
      S._b9,
      this.getPSDEFormItemUpdates(),
      objKey,
    ) as IPSDEFormItemUpdate;
  }

  protected psdeformitemvrs: IPSDEFormItemVR[];
  getPSDEFormItemVRs(): IPSDEFormItemVR[] | null {
    return (
      this.psdeformitemvrs ||
      (this.psdeformitemvrs = this.fillChildListModel(
        this.M.getPSDEFormItemVRs,
        S._ba,
      ) as IPSDEFormItemVR[])
    );
  }

  findPSDEFormItemVR(objKey: any): IPSDEFormItemVR | null {
    return this.getPSModel5(
      S._ba,
      this.getPSDEFormItemVRs(),
      objKey,
    ) as IPSDEFormItemVR;
  }

  protected psdeformitems: IPSDEFormItem[];
  getPSDEFormItems(): IPSDEFormItem[] | null {
    return (
      this.psdeformitems ||
      (this.psdeformitems = this.fillChildListModel(
        this.M.getPSDEFormItems,
        S._b6,
      ) as IPSDEFormItem[])
    );
  }

  findPSDEFormItem(objKey: any): IPSDEFormItem | null {
    return this.getPSModel5(
      S._b6,
      this.getPSDEFormItems(),
      objKey,
    ) as IPSDEFormItem;
  }

  protected psdeformpages: IPSDEFormPage[];
  getPSDEFormPages(): IPSDEFormPage[] | null {
    return (
      this.psdeformpages ||
      (this.psdeformpages = this.fillChildListModel(
        this.M.getPSDEFormPages,
        S._bc,
      ) as IPSDEFormPage[])
    );
  }

  findPSDEFormPage(objKey: any): IPSDEFormPage | null {
    return this.getPSModel5(
      S._bc,
      this.getPSDEFormPages(),
      objKey,
    ) as IPSDEFormPage;
  }

  protected pslayout: IPSLayout;
  getPSLayout(): IPSLayout | null {
    return (
      this.pslayout ||
      (this.pslayout = this.fillObjectModel(
        S._298,
        this.M.getPSLayout,
        S._2e8,
      ) as IPSLayout)
    );
  }

  get tabHeaderPos(): 'LEFT' | 'TOP' | 'RIGHT' | 'BOTTOM' {
    return this.M.tabHeaderPos;
  }

  get mobileControl(): boolean {
    return this.M.mobileControl != null ? this.M.mobileControl : false;
  }

  get noTabHeader(): boolean {
    return this.M.noTabHeader;
  }
  get cls(): string {
    return 'PSDEFormImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._23d || cls == S._ae) return true;
    return super.instanceof(cls);
  }
}
